<?php

namespace catchAdmin\pc\tables;

use catchAdmin\pc\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class Notice extends CatchTable
{

    public function Table()
    {
        return $this
            ->getTable('notice')
            ->header([
                HeaderItem::label('收件人')
                    ->prop('wechat_user_name')
                    ->width('150'),
                HeaderItem::label('标题')
                    ->prop('title')
                    ->width('150')
                    ->withButtonComponent(['zz2']),
                HeaderItem::label('内容')
                    ->prop('content'),
                HeaderItem::label('通知类型')
                    ->prop('notice_type_name')
                    ->width('150'),
                HeaderItem::label('发送时间')
                    ->prop('create_at_show')
                    ->width('150'),
                HeaderItem::label('已读时间')
                    ->prop('read_time_show')
                    ->width('150'),
//                HeaderItem::label('操作')
//                    ->actions([
//                        Actions::update(),
////                    Actions::delete(),
//                        Actions::normal('查看详情', 'zz3', 'tongguoshenhe', 'el-icon-s-tools'),
//
//                    ])
//                    ->width(260),
            ])
            ->withSearch([
                Search::label('标题')
                    ->text('title', '标题')
                    ->clearable(true),
                Search::label('内容')
                    ->text('content', '内容')
                    ->size('mini')
                    ->clearable(true),
                Search::label('收件人')
                    ->text('wechat_user_name', '收件人')
                    ->clearable(true),
                Search::label('消息类型')
                    ->select('notice_type', '选择消息类型', tableSelectArray((new \catchAdmin\model\Notice())->getNoticeTypeNameList()))
                    ->clearable(true),
            ])
            ->selectionChange()
            ->withApiRoute('notice')
            ->withActions([
//                Actions::create(),
//                Actions::export(),
            ])
            ->render();
    }


    public function form()
    {
        return Factory::create('notice');
    }

}
